public without sharing class EmailHook {

    public Student__c student {set; get;}

    public EmailHook() {
        student = [SELECT Id,Name, Student_Name__c, School_fee__c FROM Student__c WHERE Id = 'a055g000000bwt2AAA'];

        EmailHook.testMailHook('banana');
    }

    public String getReadStatus() {
        Integer no = (Integer)Math.ceil(Math.random() * 10);
        String sname = '张' + no;
        // Student__c stu = new Student__c(Student_Name__c = sname, School_fee__c = 998);
        // insert stu;     // 在getXXX和setXXX方法中不能执行DML操作
        String msg = 'Apex类执行了, 插入学生，姓名：' + sname;
        System.debug(msg);
        return msg;        
    }

    // @future
    public static void testMailHook(String sid) {
        Integer no = (Integer)Math.ceil(Math.random() * 10);
        String sname = '张' + no + sid;
        Student__c stu = new Student__c(Student_Name__c = sname, School_fee__c = 998);
        // insert stu;     // 在getXXX和setXXX方法中不能执行DML操作
        String msg = 'Apex类执行了, 插入学生，姓名：' + sname;
        System.debug(msg);
    }


    public Pagereference test() {
        System.debug('执行了EmailHook类中的test方法');
        return null;
    }

    public Pagereference save() {
        upsert student;
        System.debug('upsert student');
        return null;
    }

}